package com.cheea.associationBss.model;

import java.util.List;

import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;

/**
 * 消息的实体
 * @author Administrator
 *
 */
public class Message extends Model<Message> {
	public static final Message dao = new Message();
	
	public Page<Message> paginate(int pageNumber, int pageSize) {
		return paginate(pageNumber, pageSize, "select *", "from Message order by upTime desc");
	}

	public List<Message> getMsgLimit() {
		return dao.find("SELECT u.uname,m.message,TIMESTAMPDIFF(MINUTE ,m.upTime,SYSDATE()) as tim FROM message m,user u where m.uid=u.id and m.message<>'' ORDER BY m.upTime desc LIMIT 8");
	}
}
